package homework.mid_autumn_festival.string_exercise;

public class Test {
    public static void main(String[] args) {
        String s1 = "www.tedu.cn";
        String s2 = "htt://www.tarena.com.cn";
        System.out.println(getHostName(s1));
        System.out.println(getHostName(s2));
    }
    public static String getHostName(String url){
        int start = url.indexOf(".")+1;
        int end = url.indexOf(".",start);
        return url.substring(start,end);
    }
}
